<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<script src="/jquery.js"></script>

<script type="text/javascript">

$(document).ready(function (){
	$("#login").click(function (){
		//alert($("#getToken").serialize());
		$.ajax({
			 type: 'post', // 提交方式 get/post
	            url: '/token', // 需要提交的 url
	            data: $("#getToken").serialize(),
	            success: function(data) { // data 保存提交后返回的数据，一般为 json 数据
	            	//window.location.href="/status"    //获取sso登录状态
	            	window.location.href="${service}?token="+data
	            },
	            error: function(data) {
	                alert("error:"+data);
	            }
		});
		

	});
});

</script>
</head>

<body>
<form id="getToken" >
账户:<input id="username" name="username"/>
密码：<input id="password" name="password"/>
<input id="service"  name="service" type="hidden" value="${service}"/>

</form>
<input type="button" id="login" value="登录">
</body>
</html>